module namespace terms="http://sendmeafilter.com/common/terms";

declare boundary-space preserve;
declare option xdmp:mapping "false";

declare function terms:terms($options) {
	if('terms' = $options) then 
		<div style="display: none;" id="terms_modal">
			<div id="modal_close" title="Click to close">X
			</div>
			<h4>Terms and Conditions—SendMeAFilter.com</h4>	
			{terms:shortterms()}
		</div>
	else ()
};

declare function terms:shortterms(){
	let $terms:=fn:doc("/config/terms.xml")/xml/node()
	return 
		if($terms) then
			$terms 
		else 
		<noop>
					
			<p><em>SendMeAFilter.com</em> offers a unique service that delivers high-quality HVAC filters directly to your home at a
			frequency that you have requested.</p>
			
			<p>By accepting the terms of this agreement <strong><em>SendMeAFilter.com</em></strong> will provide the following services:</p>
			
			<ul>
							<li>Delivery of a new, clean filter at the frequency that you have selected to your home address.</li>
							<li>A 30-day guarantee that entitles the customer to a full 100% 
			refund for any or no reason. That‘s right—no questions asked. Guarantee 
			begins on the date that the service was ordered.</li>
							<li>No additional shipping charges will be added to your order. What you see is what you get.</li>
							<li>Automatic billing of charges - you have the choice of easy <strong>monthly payments</strong> (based on the total charge of each filter—including sales tax if shipped / delivered within the state of Utah) or on a <strong>per filter basis</strong> (filter will be shipped once credit card payment is confirmed).</li>
							<li>A customer service e-mail address (sendmeafilter@gmail.com) that allows you to communicate directly with our company.</li>
						</ul>
						
						<p>By accepting the terms of this agreement <strong>you (the customer) agree</strong> that:</p>
						
						<ul>
							<li>The customer has the right to cancel their service at any time 
			and for any or no reason. Once the service has been cancelled no further
			 shipments of filters will be made.</li>
							<li>Pricing may be changed at the discretion of SendMeAFilter.com at
			 any time with a 30 day notice sent to the customer‘s e-mail address or 
			mailed to the customer‘s home address.</li>
							<li>SendMeAFilter.com will not refund any monies that have been 
			received. Filters will not be sent to any customer until and unless 
			payment in full has been received (including partial payments based on 
			monthly billing).</li>
							<li>Customers in the state of Utah will be charged a sales tax based on the state‘s current rates.</li>
							<li>Your credit card will be billed on a recurring basis based on 
			the frequency that you have selected. All online orders require payments
			 to be made using a valid credit card. If SendMeAFilter.com is unable to
			 charge your credit card because of insufficient funds, invalid account,
			 expired card information, or any other reason we will e-mail, call, or 
			mail you a notice to update your credit card information. No further 
			filters will be shipped until your account information is updated.
							</li><li>If the customer has selected the monthly payment option the following conditions will apply:</li>
								<ul>
									<li>The initial charge for the monthly service will be the full 
			cost of the initial filter. The recurring monthly charges will then 
			start the following month.</li>
									<li>The customers filter will not be shipped until all monthly 
			payments have been made (based on the frequency that the customer has 
			selected).</li>
									<li>If partial payments are made and the customer cancels the 
			service (after the 30 day guarantee period) there will not be a refund 
			of the payments that have already been made.</li>
					</ul>
				
			</ul>
	</noop>/node()
};
	
	